import com.demo.component.ArticleController;
import com.demo.model.Student;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

import java.security.cert.X509Certificate;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/4/15
 */
public class App {
    public static void main(String[] args) {
        //1.先得到spring对象
//        BeanFactory context = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //2.从spring中取出除bean对象
//        User user = (User)context.getBean("user");
//        User user = context.getBean(User.class);
//        //3.使用bean(可选)
//        System.out.println(user.sayHi());
//        ArticleController articleController = context.getBean("articleController",ArticleController.class);
//        System.out.println(articleController.sayHello());
//        Student student = context.getBean("student",Student.class);
//        System.out.println(student);

    }
}
